import React, { useMemo, useState } from "react";
export default function One() {
    let [count, setCount] = useState(0)
    let [list] = useState([1, 2, 3, 4, 5])
    function getList() {
        console.log(list)
        return list.map(ele => <li key={ele}>{ele}</li>)

    }
    function add() {
        setCount(a => a + 1)
    }

    let get = useMemo(() => getList(), [list])
    return (
        <div>
            计数列表
            {count}
            <button onClick={add}>+</button>  <br />
            <hr></hr>
            数据列表
            <ul>
                {get}
                {/* {getList()} */}
            </ul>
        </div>
    )
}